package com.pearl.shardingproxy.demo.controller;


import com.pearl.shardingproxy.demo.entity.OrderEntity;
import com.pearl.shardingproxy.demo.mapper.OrderMapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import lombok.RequiredArgsConstructor;

import java.time.LocalDateTime;
/**
 * <p>
 * 订单信息表 前端控制器
 * </p>
 *
 * @author 自动代码生成
 * @since 2024-01-24
 */
@RestController
@RequestMapping("/order")
@RequiredArgsConstructor
public class OrderController {

    private final OrderMapper orderMapper;

    @GetMapping("/save")
    public Object save() {
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setPhone(18888888888L);
        orderEntity.setAddress("湖南长沙");
        orderEntity.setOrderTime(LocalDateTime.now());
        orderEntity.setProductId(1L);
        orderEntity.setOrderTime(LocalDateTime.now());
        orderMapper.insert(orderEntity);
        System.out.println("插入数据："+orderEntity);
        return "操作成功";
    }
}